home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Löwenzahn 1
/
Loewe1.iso
/
mac
/
Quicktime 6 für OS X
/
QuickTimeInstallerX.dmg
/
QuickTime652.pkg
/
Contents
/
Resources
/
postflight
< prev
next >
Wrap
Text File
|
2004-09-07
|
5KB
|
188 lines
#!/usr/bin/perl
my $SYSVERS = "$ARGV[3]"."/System/Library/CoreServices/SystemVersion.plist";
my $runnerPID = getppid();
my $installerPID = "";
my $uid = "";
my $uname = "";
open( PSOUT, "/bin/ps -axww -o pid,ppid -p $runnerPID |" );
while( <PSOUT> ) {
my @fields = split '\s+', $_;
if ("$fields[1]" eq "$runnerPID") {
$installerPID = $fields[2];
}
}
close( PSOUT );
if ("$installerPID" ne "") {
open( PSOUT, "/bin/ps -axww -o pid,ruid -p $installerPID |" );
while( <PSOUT> ) {
my @fields = split '\s+', $_;
if ("$fields[1]" eq "$installerPID") {
$uid = $fields[2];
}
}
close( PSOUT );
}
if ("$uid" ne "") {
open( PSOUTA, "/usr/bin/id -p $uid |" );
while( <PSOUTA> ) {
my @fields = split '\s+', $_;
if ("$fields[0]" eq "uid") {
$uname = $fields[1];
}
}
close( PSOUTA );
}
###################################################################
# Remove old unneeded quicktime pieces
my $CLEANUP_SCRIPT = "$ARGV[0]" . "/Contents/Resources/cleancruft";
$cmd = "\"$CLEANUP_SCRIPT\" \"$ARGV[0]\" \"$ARGV[1]\" \"$ARGV[2]\" \"$ARGV[3]\"";
system( "$cmd" );
########
# Stuff the installation info into the preferences for QT Updates
my $INSTALL_INFO= "$ARGV[0]" . "/Contents/Resources/installinfo";
my $cmd = "\"$INSTALL_INFO\" -postinstall -volume \"$ARGV[2]\" -type full";
#print STDOUT "INSTALL_INFO: $cmd\n";
system( "$cmd" );
########
# Configure the browser mime types based on the installed QuickTime
my $CONFIGURE_MIME_TYPES= "$ARGV[0]" . "/Contents/Resources/ConfigureMimeTypes";
my $cmd = "\"$CONFIGURE_MIME_TYPES\" -rescan -verbose";
if ("$uname" ne "") {
$cmd = "sudo -u $uname \"$CONFIGURE_MIME_TYPES\" -rescan -verbose";
}
#print STDOUT "CONFIGURE_MIME_TYPES: $cmd\n";
system( "$cmd" );
########
#print STDOUT "BEFORE CheckVersion: $SYSVERS\n";
if(CheckVersion( "$SYSVERS", "10.3", "ProductVersion", "<" )) {
# Install quicktime's version of AvailabilityMacros.h if it's there
my $INSTALL_QTFILES = "$ARGV[0]" . "/Contents/Resources/installqtfiles";
$cmd = "\"$INSTALL_QTFILES\" \"$ARGV[0]\" \"$ARGV[1]\" \"$ARGV[2]\" \"$ARGV[3]\"";
system( "$cmd" );
# Rebase and prebind the binaries for Jaguar
my $REBASE_SCRIPT = "$ARGV[0]" . "/Contents/Resources/rebasebinaries";
$cmd = "\"$REBASE_SCRIPT\" \"$ARGV[0]\" \"$ARGV[1]\" \"$ARGV[2]\" \"$ARGV[3]\"";
system( "$cmd" );
# Wrap the plugin in a fat container
my $WRAPPLUGIN_SCRIPT = "$ARGV[0]" . "/Contents/Resources/wrapplugin";
$cmd = "\"$WRAPPLUGIN_SCRIPT\" \"$ARGV[0]\" \"$ARGV[1]\" \"$ARGV[2]\" \"$ARGV[3]\"";
system( "$cmd" );
}
###########
###########
my $permissions_info_file = "/tmp/com.apple.installation.savedperm";
my @stat_info;
my $MODE = 2;
my $UID = 4;
my $GID = 5;
if(-e $permissions_info_file) {
if(open(PERMS_FILE_HDL, "$permissions_info_file")) {
while(<PERMS_FILE_HDL>) {
my $item = $_;
chomp($item);
push(@stat_info, $item);
}
close(PERMS_FILE_HDL);
unlink($permissions_info_file);
chown($stat_info[$UID], $stat_info[$GID], $TARGET_VOLUME);
chmod($stat_info[$MODE] & 07777, $TARGET_VOLUME);
}
}
# NOTE: Use this to see print when debugging
#$cmd = "mkdir -p /tmp/done";
#system( "$cmd" );
# Done
exit(0);
##################
sub CheckVersion
{
my $path = $_[0];
my $version = $_[1];
my $keyName = $_[2];
my $operator = $_[3];
if (! -e $path) {
return 0;
}
if (!$operator) {
$operator = "==";
}
my $oldSeperator = $/;
$/ = \0;
open( PLIST, "$path") || do {
return 0;
};
$plistData = <PLIST>;
$plistData =~ /<dict>(.*?)<\/dict>/gis;
@items = split(/<key>/, $plistData);
shift @items;
foreach $item (@items) {
$item =~ /(.*?)<\/key>.*?<string>(.*?)<\/string>/gis;
$versiondata{ $1 } = $2;
}
close(PLIST);
$/ = $oldSeperator;
@theVersionArray = split(/\./, $versiondata{$keyName});
for ($i = 0; $i < 3; $i++) {
if(!$theVersionArray[$i]) {
$theVersionArray[$i] = '0';
}
}
@versionArray = split(/\./, $version);
my $actualVersion;
for ($i = 0; $i < 3; $i++) {
if (($theVersionArray[$i] != $versionArray[$i]) or ($i == 2)) {
$actualVersion = $theVersionArray[$i];
$version = $versionArray[$i];
last;
}
}
my $expression = '$actualVersion ' . $operator . ' $version';
if( eval ($expression) )
{
return 1;
}
else
{
return 0;
}
}